import Vue from 'vue'
import App from './App.vue'
import './plugins/element.js'
import router from './router'
import './style.css'

/**
 * @author jehu
 * @data 2019/09/04
 * 解决点击路由跳转相同地址报错
 * NavigationDuplicated{name:"NavigationD"}
 */
import Router from 'vue-router'
const originalPush = Router.prototype.push
Router.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err)
}

Vue.config.productionTip = false


import http from './http'
Vue.prototype.$http=http


//相当于定义全局的方法，哪都能用，这里是给上传图片时添加请求头
Vue.mixin({
  computed:{
    uploadUrl(){
      return this.$http.defaults.baseURL+'/upload'
    }
  },
  methods: {
   getAuthHeaders(){
     return{
       Authorization:`Bearer ${localStorage.token||''}`
     }
   } 
  }
})

new Vue({
  router,
  render: h => h(App)
}).$mount('#app')
